﻿namespace TimeTableEasy.src.Core
{
    public class Singleton<E> where E : class , new()
    {
        private static object _syncobj = new object();
        private static volatile E _instance = null;

        public static E Instance
        {
            get
            {
                if (_instance == null)
                {
                    lock (_syncobj)
                    {
                        if (_instance == null)
                        {
                            _instance = new E();
                        }
                    }
                }
                return _instance;
            }
        }

        public Singleton()
        { }


    }

}
